﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace Tanks
{
    public partial class TimerWindow : ChildWindow
    {
        DispatcherTimer dt;
        int sec = 5;
        public TimerWindow()
        {
            InitializeComponent();

            dt = new DispatcherTimer();
            dt.Interval = new TimeSpan(0, 0, 0, 1);
            dt.Tick += new EventHandler(dt_Tick);
            dt.Start();
        }

        void dt_Tick(object sender, EventArgs e)
        {
            sec--;
            if (sec == 0)
            {
                dt.Stop();
                Close();
            }
            else
            {
                textBlock1.Text = "До начала игры: " + sec.ToString();
            }
        }
    }
}

